package day4.HomeWork;

public class Student {
    /*
    实现封装一个学生的基本信息，实现对姓名、年龄、性别、学号属
    性的封装，确保属性不被外部直接访问，同时提供合适的方法访问和修改这些属
    性*/
    //1.对属性私有化，确保属性不被外部直接访问
    private  String name;
    private int age;
    private String gender;
    private String id;

    //构造函数


    public Student() {
    }

    public Student(String name, int age, String gender, String id) {
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.id = id;
    }

    //2.提供合适的方法访问和修改这些属性
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
}
